/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author VietTien
 */
@Entity
@Table(name = "Winner")
@NamedQueries({
    @NamedQuery(name = "Winner.findAll", query = "SELECT w FROM Winner w WHERE w.isDelete = :isDelete"),
    @NamedQuery(name = "Winner.findByWinnerID", query = "SELECT w FROM Winner w WHERE w.winnerID = :winnerID"),
    @NamedQuery(name = "Winner.findByPrice", query = "SELECT w FROM Winner w WHERE w.price = :price"),
    @NamedQuery(name = "Winner.findByIsDelete", query = "SELECT w FROM Winner w WHERE w.isDelete = :isDelete")})
public class Winner implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "WinnerID")
    private Integer winnerID;
    @Basic(optional = false)
    @Column(name = "Price")
    private String price;
    @Basic(optional = false)
    @Column(name = "isDelete")
    private boolean isDelete;
    @JoinColumn(name = "RegID", referencedColumnName = "RegID")
    @ManyToOne(optional = false)
    private Registration registration;
    public Winner() {
    }
    public Winner(Integer winnerID) {
        this.winnerID = winnerID;
    }

    public Winner(Integer winnerID, String price, boolean isDelete) {
        this.winnerID = winnerID;
        this.price = price;
        this.isDelete = isDelete;
    }

    public Winner(String price, boolean isDelete, Registration registration) {
        this.price = price;
        this.isDelete = isDelete;
        this.registration = registration;
    }

    public Integer getWinnerID() {
        return winnerID;
    }

    public void setWinnerID(Integer winnerID) {
        this.winnerID = winnerID;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public boolean getIsDelete() {
        return isDelete;
    }

    public void setIsDelete(boolean isDelete) {
        this.isDelete = isDelete;
    }

    public Registration getRegistration() {
        return registration;
    }

    public void setRegistration(Registration registration) {
        this.registration = registration;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (winnerID != null ? winnerID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Winner)) {
            return false;
        }
        Winner other = (Winner) object;
        if ((this.winnerID == null && other.winnerID != null) || (this.winnerID != null && !this.winnerID.equals(other.winnerID))) {
            return false;
        }
        return true;
    }
    @Override
    public String toString() {
        return "entity.Winner[winnerID=" + winnerID + "]";
    }

}
